<template>
  <div class="like-page">
    <van-nav-bar fixed title="我的点赞" />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <ArticleItem v-for="(item,i) in likeList" :key="i" :item="item" />
    </van-list>

  </div>

</template>

<script>
import { getLikeApi } from '@/api/article'
export default {
  name: 'LikePage',
  data () {
    return {
      params: {
        current: 1
      },
      likeList: [],
      loading: false,
      finished: false
    }
  },

  methods: {
    async onLoad () {
      const { data } = await getLikeApi(this.params)
      this.likeList.push(...data.rows)
      this.loading = false
      this.params.current++

      if (this.params.current > data.pageTotal) {
        this.finished = true
      }
    }
  }
}
</script>

<style lang="less" scoped>
.like-page {
  margin-bottom: 50px;
  margin-top: 44px;
}
</style>
